/**
 * 构造要素分类图层树
 * @param {*} datas 
 * @param {*} pcode 
 * @param {*} dataTree 
 */
export function recursiveTree(datas, pcode, dataTree = [], level) {
    
    for (let l = 0; l < datas.length; l++) {
        const data = datas[l];
        // 父节点
        if (data.pcode === pcode) {

            data.children = data.children || [];
            data.title = data.name;
            data.key = data.code;
            data.level = level;
            data.classifyType = data.disabled;
            delete data['disabled'];

            dataTree.push(data);

            recursiveTree(datas, data.code, data.children, level + 1);
        }
    }

    return dataTree;
}